﻿Imports System.Text
Namespace Transaction
    Public Class clsbindItemWithConfirmRow
        Inherits ADODBU.RowClass
        Private mVar_BARCODE As System.String
        Private mVar_ARTCEXT As System.String
        Private mVar_SIZE As System.String
        Private mVar_COLOR As System.String
        Private mVar_BARDESCR As System.String
        Private mVar_SPAMOUNT As System.Int32
        Private mVar_DISC As System.Decimal
        Private mVar_SLSQTY As System.Int32
        Private mVar_SLSPRICE As System.Decimal
        Private mVar_SLSTOTAMT As System.Decimal
        Private mVar_DirtyBARCODE As Boolean = False
        Private mVar_DirtyARTCEXT As Boolean = False
        Private mVar_DirtySIZE As Boolean = False
        Private mVar_DirtyCOLOR As Boolean = False
        Private mVar_DirtyBARDESCR As Boolean = False
        Private mVar_DirtySPAMOUNT As Boolean = False
        Private mVar_DirtyDISC As Boolean = False
        Private mVar_DirtySLSQTY As Boolean = False
        Private mVar_DirtySLSPRICE As Boolean = False
        Private mVar_DirtySLSTOTAMT As Boolean = False
        Private mIsOnInit As Boolean
        Public DataSource As ADODBU.Recordset
        Public RowOrigin As clsbindItemWithConfirmRow
        ''[------------------------------------------------------------------------]'
        Public Sub New()
            RowOrigin = New clsbindItemWithConfirmRow(True)
        End Sub
        ''[------------------------------------------------------------------------]'
        Friend Sub New(ByVal lCut As Boolean)
            '--- untuk memutus loop reference 
        End Sub
        ''[------------------------------------------------------------------------]'
        ''' <summary>
        ''' create new this class from inherited of this class or its self
        ''' </summary>
        ''' <param name="recdataRow"></param>
        ''' <remarks></remarks>
        Public Sub New(ByVal recdataRow As ADODBU.RowClass)
            RowOrigin = New clsbindItemWithConfirmRow(True)
            Me.JoinValue(recdataRow)
        End Sub
        ''[------------------------------------------------------------------------]'
        Public Sub New(ByVal recData As ADODBU.Recordset)
            RowOrigin = New clsbindItemWithConfirmRow(True)
            DataSource = recData
            Try
                InitVar(recData.GetCurrentDataRow)
            Catch
            End Try
        End Sub

        ''[------------------------------------------------------------------------]'
        Public Sub New(ByVal recdataRow As DataRow)
            RowOrigin = New clsbindItemWithConfirmRow(True)
            InitVar(recdataRow)
        End Sub

#Region "Initialize vars "
        ''[------------------------------------------------------------------------]'
        Private Sub InitVar(ByVal Fields As DataRow)
            Try
                mVar_BARCODE = Fields("BARCODE")
                RowOrigin.BARCODE = mVar_BARCODE
            Catch e As Exception
            End Try
            Try
                mVar_ARTCEXT = Fields("ARTCEXT")
                RowOrigin.ARTCEXT = mVar_ARTCEXT
            Catch e As Exception
            End Try
            Try
                mVar_SIZE = Fields("SIZE")
                RowOrigin.SIZE = mVar_SIZE
            Catch e As Exception
            End Try
            Try
                mVar_COLOR = Fields("COLOR")
                RowOrigin.COLOR = mVar_COLOR
            Catch e As Exception
            End Try
            Try
                mVar_BARDESCR = Fields("BARDESCR")
                RowOrigin.BARDESCR = mVar_BARDESCR
            Catch e As Exception
            End Try
            Try
                mVar_SPAMOUNT = Fields("SPAMOUNT")
                RowOrigin.SPAMOUNT = mVar_SPAMOUNT
            Catch e As Exception
            End Try
            Try
                mVar_DISC = Fields("DISC")
                RowOrigin.DISC = mVar_DISC
            Catch e As Exception
            End Try
            Try
                mVar_SLSQTY = Fields("SLSQTY")
                RowOrigin.SLSQTY = mVar_SLSQTY
            Catch e As Exception
            End Try
            Try
                mVar_SLSPRICE = Fields("SLSPRICE")
                RowOrigin.SLSPRICE = mVar_SLSPRICE
            Catch e As Exception
            End Try
            Try
                mVar_SLSTOTAMT = Fields("SLSTOTAMT")
                RowOrigin.SLSTOTAMT = mVar_SLSTOTAMT
            Catch e As Exception
            End Try
        End Sub


#End Region
        ''[------------------------------------------------------------------------]'
#Region "Properties"
        Public Property BARCODE As System.String
            Get
                Return mVar_BARCODE
            End Get
            Set(ByVal Value As System.String)
                mVar_BARCODE = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("BARCODE"))
                If Not mIsOnInit Then
                    mVar_DirtyBARCODE = True
                End If
            End Set
        End Property
        Public Property ARTCEXT As System.String
            Get
                Return mVar_ARTCEXT
            End Get
            Set(ByVal Value As System.String)
                mVar_ARTCEXT = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("ARTCEXT"))
                If Not mIsOnInit Then
                    mVar_DirtyARTCEXT = True
                End If
            End Set
        End Property
        Public Property SIZE As System.String
            Get
                Return mVar_SIZE
            End Get
            Set(ByVal Value As System.String)
                mVar_SIZE = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("SIZE"))
                If Not mIsOnInit Then
                    mVar_DirtySIZE = True
                End If
            End Set
        End Property
        Public Property COLOR As System.String
            Get
                Return mVar_COLOR
            End Get
            Set(ByVal Value As System.String)
                mVar_COLOR = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("COLOR"))
                If Not mIsOnInit Then
                    mVar_DirtyCOLOR = True
                End If
            End Set
        End Property
        Public Property BARDESCR As System.String
            Get
                Return mVar_BARDESCR
            End Get
            Set(ByVal Value As System.String)
                mVar_BARDESCR = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("BARDESCR"))
                If Not mIsOnInit Then
                    mVar_DirtyBARDESCR = True
                End If
            End Set
        End Property
        Public Property SPAMOUNT As System.Int32
            Get
                Return mVar_SPAMOUNT
            End Get
            Set(ByVal Value As System.Int32)
                mVar_SPAMOUNT = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("SPAMOUNT"))
                If Not mIsOnInit Then
                    mVar_DirtySPAMOUNT = True
                End If
            End Set
        End Property
        Public Property DISC As System.Decimal
            Get
                Return mVar_DISC
            End Get
            Set(ByVal Value As System.Decimal)
                mVar_DISC = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("DISC"))
                If Not mIsOnInit Then
                    mVar_DirtyDISC = True
                End If
            End Set
        End Property
        Public Property SLSQTY As System.Int32
            Get
                Return mVar_SLSQTY
            End Get
            Set(ByVal Value As System.Int32)
                mVar_SLSQTY = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("SLSQTY"))
                If Not mIsOnInit Then
                    mVar_DirtySLSQTY = True
                End If
            End Set
        End Property
        Public Property SLSPRICE As System.Decimal
            Get
                Return mVar_SLSPRICE
            End Get
            Set(ByVal Value As System.Decimal)
                mVar_SLSPRICE = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("SLSPRICE"))
                If Not mIsOnInit Then
                    mVar_DirtySLSPRICE = True
                End If
            End Set
        End Property
        Public Property SLSTOTAMT As System.Decimal
            Get
                Return mVar_SLSTOTAMT
            End Get
            Set(ByVal Value As System.Decimal)
                mVar_SLSTOTAMT = Value
                Me.OnPropertyChanged(New System.ComponentModel.PropertyChangedEventArgs("SLSTOTAMT"))
                If Not mIsOnInit Then
                    mVar_DirtySLSTOTAMT = True
                End If
            End Set
        End Property
        Public ReadOnly Property BARCODEIsDirty As Boolean
            Get
                Return mVar_DirtyBARCODE
            End Get
        End Property
        Public ReadOnly Property ARTCEXTIsDirty As Boolean
            Get
                Return mVar_DirtyARTCEXT
            End Get
        End Property
        Public ReadOnly Property SIZEIsDirty As Boolean
            Get
                Return mVar_DirtySIZE
            End Get
        End Property
        Public ReadOnly Property COLORIsDirty As Boolean
            Get
                Return mVar_DirtyCOLOR
            End Get
        End Property
        Public ReadOnly Property BARDESCRIsDirty As Boolean
            Get
                Return mVar_DirtyBARDESCR
            End Get
        End Property
        Public ReadOnly Property SPAMOUNTIsDirty As Boolean
            Get
                Return mVar_DirtySPAMOUNT
            End Get
        End Property
        Public ReadOnly Property DISCIsDirty As Boolean
            Get
                Return mVar_DirtyDISC
            End Get
        End Property
        Public ReadOnly Property SLSQTYIsDirty As Boolean
            Get
                Return mVar_DirtySLSQTY
            End Get
        End Property
        Public ReadOnly Property SLSPRICEIsDirty As Boolean
            Get
                Return mVar_DirtySLSPRICE
            End Get
        End Property
        Public ReadOnly Property SLSTOTAMTIsDirty As Boolean
            Get
                Return mVar_DirtySLSTOTAMT
            End Get
        End Property
#End Region
        ''[------------------------------------------------------------------------]'
        Public Function SaveToDataSource() As String
            Dim msgErr As String
            msgErr = "Query"
            Return msgErr
        End Function
        ''[------------------------------------------------------------------------]'
        Public Sub ClearDirty()
            mVar_DirtyBARCODE = False
            mVar_DirtyARTCEXT = False
            mVar_DirtySIZE = False
            mVar_DirtyCOLOR = False
            mVar_DirtyBARDESCR = False
            mVar_DirtySPAMOUNT = False
            mVar_DirtyDISC = False
            mVar_DirtySLSQTY = False
            mVar_DirtySLSPRICE = False
            mVar_DirtySLSTOTAMT = False
        End Sub
        ''[------------------------------------------------------------------------]'
        Public Sub SetDirty()
            mVar_DirtyBARCODE = True
            mVar_DirtyARTCEXT = True
            mVar_DirtySIZE = True
            mVar_DirtyCOLOR = True
            mVar_DirtyBARDESCR = True
            mVar_DirtySPAMOUNT = True
            mVar_DirtyDISC = True
            mVar_DirtySLSQTY = True
            mVar_DirtySLSPRICE = True
            mVar_DirtySLSTOTAMT = True
        End Sub

    End Class
End Namespace